(function () {
	return {
		init:function(){
			ajaxGet({
				url:"tengpaiMock/timeStatus",
				success:function(data){
					_this.data.timeStatus=data.data;
					_this.reload();
				}
			})
		},
		data:{
			timeStatus:false
		},
       before: function (data) {
		  return data;
       },
       after: function () {
       	var _this = this;
       	var onLoadSuccess=function () {
       	}
       	bootstrapTable(_this.$(".bootstrapTable"), {
		       	url: 'tengpaiMock/findPage',
		       	columns: [
 		      	{
		       	    field: 'selectItem',
		       	    checkbox: true,
		       	},
		       	{
 		      	    field: 'id',
		       	    title: '主键',
 		      	    visible:false,
		       	    sortable:true
 		      	},
		       	{
 		      	    field: 'productId',
		       	    title: '产品id',
		       	    sortable:true
 		      	},
		       	{
 		      	    field: 'mockPlayer',
		       	    title: '模拟玩家',
		       	    sortable:true
 		      	},
		       	{
 		      	    field: 'productName',
		       	    title: '产品名称',
		       	    sortable:true
 		      	},
		       	{
 		      	    field: 'buyCount',
		       	    title: '购买数量',
		       	    sortable:true
 		      	},
		       	{
 		      	    field: 'operate',
 		      	    title: '操作',
		       	    formatter: function (value, row, index) {
 		      	        return bootstrapTableBtn(value, row, index, row.id).
 		      	        joinBtn("e-go", "详情","href='module/tengpai/mock/info?id="+row.id+"'").
 		      	        joinBtn("e-go", "修改","href='module/tengpai/mock/update?id="+row.id+"'").
				       	joinBtn("e-table-delete", "删除",'url="tengpai/mock/delete" data-id="'+row.id+'"')
.toString();			       	}
		       	}
		       	],
		       	onLoadSuccess: onLoadSuccess
			});


       	_this.$(".e-changeStatus").click(function(){
       		var $this=$(this);
       		ajaxGet({
				url:"tengpaiMock/changeStatus",
				success:function(data){
					if(data.data){
						$this.html("开启机器");
					}else{
						$this.html("暂停机器");
					}
				}
			})
		});

       	_this.$(".e-init-goods").click(function(){
			ajaxGet({
				url:"tengpaiMock/initGoods",
				success:function(data){
					toastr.success("初始化成功");
				}
			})
		});
		}
	}
});
